<%@page import="java.sql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>插入信息提示</title>
</head>
<body>
<%--JSP内置对象：
	out:负责输出
	request:负责客户端发送的请求
	response:负责设置响应信息
--%>
	<%
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String driver = "com.mysql.cj.jdbc.Driver";
		String url = "jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai";
		Class.forName(driver);
		Connection conn = DriverManager.getConnection(url, "root", "Zxl5201314,");
		String sql = "insert into user values(?,?)";
		PreparedStatement psmt = conn.prepareStatement(sql);
		psmt.setString(1, username);
		psmt.setString(1, password);
		int n = psmt.executeUpdate();
		out.println("已影响的行数：" + n);
		psmt.close();
		conn.close();
	%>
</body>
</htm>